#include "task.h"
#include "myiic.h"
#include "adc.h"

#define FACTOR_I 100
OS_STK adc_task_STK[ADC_STK_SIZE];

void adc_task(void *pdata)
{
    float temp;
    INA226_Init();
    while (1) {
        delay_ms(20);
        temp     = INA226_GetVoltage();
        sample.V = temp * argument.calibration_V;
        temp     = INA226_GetShuntVoltage();
        if (temp >= 0) {
            sample.I = temp * FACTOR_I * argument.calibration_I_P;
        } else {
            sample.I = temp * FACTOR_I * argument.calibration_I_N;
        }
    }
}
